import { reactive } from "vue";
import { defineStore } from 'pinia';

export const useMenuStore = defineStore('menu', {
    state: () => ({
        // 当前选中的组织ID  
        selectedMenuNode: null,
        menuModel: reactive({
            id: '',
            menuName: '',
            pid: '',
            pName: '',
            url: '',
            sort:null,
            addTime: null,
            addUserId: '',
            editTime: null,
            editUserId: '',
        })
    }),
    actions: {
        // 更新当前选中的组织ID  
        setSelectedMenuNode(menu) {
            this.selectedMenuNode = menu;
        },
        resetMenuModel() {
            this.menuModel = {
                id: '',
                menuName: '',
                pid: '',
                pName: '',
                url: '',
                sort:null,
                addTime: null,
                addUserId: '',
                editTime: null,
                editUserId: '',
            };
        }
    },
    getters: {
        // 获取当前选中组织的名称  
        selectedMenuName: () => {

        },
    },
});